package com.sofoscorp.android.gestcobranzamobile;

import java.util.Calendar;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class GestCobranzaMobileDB extends SQLiteOpenHelper {
	
	private static int gv_version = 1;
	private static String gv_name = "GestCobranzaMobileDB" ;
	private static CursorFactory gv_factory = null;
	
	public GestCobranzaMobileDB(Context context){
		super(context,gv_name,gv_factory,gv_version);
	}
	@Override
	public void onCreate(SQLiteDatabase ivDB) {
		// TODO Auto-generated method stub
		Calendar lo_calendar = Calendar.getInstance();
		int lv_year = 0;
		ContentValues go_record = null;
		lv_year = lo_calendar.get(Calendar.YEAR);
		
		ivDB.execSQL( "CREATE TABLE IF NO EXISTS RANGE_NUMBER(" +
		          									"TYPOP	TEXT," +
		          									"RANGE	TEXT," +
		          									"GJAHR 	TEXT," +
		          									"RGMIN	INTEGER," +
		          									"RGMAX	INTEGER," +
		          									"COUNT	INTEGER," +
		          									"PRIMARY KEY(TYPOP, RANGE, GJAHR))");
		
		for (int i = 0; i < 99; i++) {			
//			ivDB.execSQL("INSERT INTO RANGE_NUMBER(TYPOP, RANGE, GJAHR, RGMIN, RGMAX) " +
//						"VALUES('A','01',"+ Integer.toString(lv_year), 1000000000, 1499999999+")");
//			ivDB.execSQL("INSERT INTO RANGE_NUMBER(TYPOP, RANGE, GJAHR, RGMIN, RGMAX) " +
//					"VALUES('C','01',"+ Integer.toString(lv_year) +"'1500000000','1999999999')");
//			lv_year = lv_year + 1;
		}
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
		// TODO Auto-generated method stub

	}

}
